<template>
  <div class="ShopStar">
    <div class="choose" v-for="item in info" :key="item.id">
      <div class="one" v-if="item.type == 1 && item.cover.length < 2">
        <div class="left">
          <div class="top">
            {{ item.title }}
          </div>
          <div class="bottom">
            <span class="nickname">{{ item.user.nickname }}</span>
            <span class="number">{{ item.comments.length }}跟帖</span>
          </div>
        </div>
        <div class="right">
          <img
            :src="Fixedurl(obj.url)"
            alt=""
            v-for="obj in item.cover"
            :key="obj.id"
          />
        </div>
      </div>
      <div class="three" v-if="item.type == 1 && item.cover.length > 2">
        <div class="top">{{ item.title }}</div>
        <div class="imgs">
          <img
            :src="Fixedurl(obj.url)"
            alt=""
            v-for="obj in item.cover"
            :key="obj.id"
          />
        </div>
        <div class="bottom">
          <span class="nickname">{{ item.user.nickname }}</span>
          <span class="number">{{ item.comments.length }}跟帖</span>
        </div>
      </div>
      <div class="movie" v-else>
        <div class="top">{{ item.title }}</div>
        <div class="tv">
          <div class="img">
            <img
              :src="Fixedurl(obj.url)"
              alt=""
              v-for="obj in item.cover"
              :key="obj.id"
            />
          </div>
          <div class="myicon">
            <i class="iconfont iconshipin"></i>
          </div>
        </div>
        <div class="bottom">
          <span class="nickname">{{ item.user.nickname }}</span>
          <span class="number">{{ item.comments.length }}</span>
        </div>
      </div>
    </div>
  </div>
</template>


<script>
export default {
  data() {
    return {};
  },
  props: ["info"],
  methods: {
    Fixedurl(url) {
      if (url.startsWith("http")) {
        return url;
      } else {
        return this.$axios.defaults.baseURL + url;
      }
    },
  },
};
</script>

<style scoped lang='less'>
.ShopStar {
  .top {
    font-size: 14px;
    line-height: 20px;
  }
  .bottom {
    font-size: 12px;
    opacity: 0.5;
    .nickname {
      padding-right: 20px;
    }
  }
  .one {
    height: 80px;
    display: flex;
    padding: 10px;
    border-bottom: 1px solid black;
    .left {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .right {
      img {
        width: 120px;
        object-fit: contain;
        height: 80px;
      }
    }
  }
  .three {
    border-bottom: 1px solid black;
    padding: 10px;
    .imgs {
      display: flex;
      justify-content: space-around;
      img {
        height: 60px;
        object-fit: contain;
      }
    }
  }
  .movie {
    border-bottom: 1px solid black;
    padding: 10px;
    .tv {
      position: relative;
      img {
        height: 170px;
        width: 340px;
        object-fit: contain;
      }
      .myicon {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        background-color: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        .iconfont {
          font-size: 50px;
          color: #fff;
        }
      }
    }
  }
}
</style>